﻿#include <iostream>
#include <boost/asio.hpp>
#include "server/game_server.h"
int main(int argc, char* argv[]) {
    try {
        if (argc != 2) {
            std::cerr << "Usage: game_server <port>\n";
            return 1;
        }
        // 初始化Protobuf库
        GOOGLE_PROTOBUF_VERIFY_VERSION;

        boost::asio::io_context io_context;

        // 创建游戏服务器
        GameServer server(io_context, std::atoi(argv[1]));

        // 运行IO上下文
        io_context.run();

        // 清理Prorobuf
        google::protobuf::ShutdownProtobufLibrary();
    }
    catch (std::exception& e) {
        std::cerr << "Exception: " << e.what() << std::endl;
    }
    return 0;
}
